package tsinghua.smxq.mc;

import tsinghua.smxq.utilitiespayment.RecordsTable;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class RecordsActivity extends Activity {
	int type = 0; // 默认为水费
	boolean isAll;
	int month;
	Button back;
	private LinearLayout linearLayout;
	private String[][] items;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_records);
		back = (Button)findViewById(R.id.utilities_records_back);
		back.setOnClickListener(new Button.OnClickListener(){

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				RecordsActivity.this.finish();
			}
			
		});
		linearLayout = (LinearLayout) findViewById(R.id.linearLayout_records);

		// 要查询的字段和对应显示的名称
		items = new String[][] { { "recordid", "记录编号" }, { "month", "时间" },
				{ "usage", "数量" }, { "haspaid", "支付状态" } };
		type = getIntent().getIntExtra("type", 0);
		isAll = getIntent().getBooleanExtra("isAll", true);
		if (!isAll) {
			month = getIntent().getIntExtra("month", 1);
		}

		RecordsTable recordstable = new RecordsTable(this, items, Constants.countPerPage, type,
				isAll, month);
		linearLayout.addView(recordstable);
	}

}
